package cn.com.chengmandian.bike.constants;

public enum FaultBillType {

    // 问题类型 1-还车点误判 2-禁停区误判 3-运营区外误判 4-车辆故障 5-开锁失败 6-无法还车 7-忘记还车 8-车辆没电 99-其它
    RETURN(1, "还车点误判"),
    NO_PARKING(2, "禁停区误判"),
    AREA(3, "禁停区误判"),
    BIKE_FAULT(4, "车辆故障"),
    OPEN_FAIL(5, "开锁失败"),
    NO_RETURN(6, "无法还车"),
    FORGET_RETURN(7, "忘记还车"),
    CHARGE_BIKE(8, "车辆没电"),
    OTHER(99, "其它");

    private Integer code;
    public Integer getCode(){
        return this.code;
    }

    private String name;
    public String getName(){
        return this.name;
    }

    public static FaultBillType getByCode(Integer code){
        if(code == null){
            return null;
        }else{
            FaultBillType[] types = values();
            for(FaultBillType type :types){
                if(type.getCode().equals(code)){
                    return type;
                }
            }
        }
        return null;
    }

    FaultBillType(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
